package cn.iocoder.yudao.module.mp.controller.app.user;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.mp.service.user.MpUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;

@Tag(name = "公众号 APP - 公众号粉丝")
@RestController
@RequestMapping("/mp/user")
@Validated
@Slf4j
public class AppMpUserController {

    @Resource
    private MpUserService mpUserService;

    @GetMapping("/getQrcode")
    @Operation(summary = "判断是否关注公众号")
    @PreAuthenticated
    public CommonResult<Boolean> getQrcode() {
        return success(mpUserService.getQrcode(getLoginUserId()));
    }

}
